fixed some zooming issues when the position is near the  borders