on re-pathing, make sure there's no division by zero, and that the directions are integers

This fixes issue #6