fix integer division bug