2 possibilities.....First your fish maybe suffocating from lack of oxygen. Fish that hang out near the filter are either females hiding to drop fry or the fish are there to get oxygen since this is where the most oxygen is when a tank does not have adequate oxygen levels. Goldfish are very active fish so this is not normal. Secondly...if the goldfish can not swim down to the bottom of the tank, it may have swim bladder disorder and could be from constipation. The cooked,peeled pea is good for constipation if you can get the goldfish to eat it.