zoom algorithm fixes

varible declaration fix
division fix