Surface foam is an indication of too much organic waste, which increases the surface tension and traps bubbles. Water needs to be kept cleaner; more frequent and/or larger partial water changes, fast-growing live plants, fresh filter carbon or purigen are all helpful for that.