Fixes for edge snapping.
Merge pull request #530 from slembcke/edge-snapping

Fixes for edge snapping.