fix snapping bug