EWWWW
Just kidding!
The "Black Bugs".....Are they really black, or red? How long, thick are they? Are the little flies like small mosquitoes? Or like House Flies?
If the Larvae are red, long (~1/4") and skinney, they could be Bloodworms. They would very happily live in your filter media. Look in your gravel up against the glass and see if you can spot some "dirt tunnels". The bloodworms will create these tunnels in your gravel to live in. Some will get sucked into the filter, and will use the media instead of gravel to live in.
If that's what they are, don't worry about it. Your fish will love you for providing a steady supply of live food, and it's FREEE
If the flies bother you too much, I don't know what to say, except think about the FREE FOOD part
I had them and the fishies loved them, especially when I vacced and fed them back to the fish. I never got rid of them until I got my Peppered Cories. They dug them out of the gravel and ate them all.......little PIGS
Now, if that's NOT what you have, I don't know...............