fix #4610: "Can't build near bottom and right edge of the map"