Fix problem in snapping