fix top/bottom reversal problem