fix panning, but it does overflow