Fix snap-to-grid
Fixes #177