Fixed a bug which crashed the browser when grid snap = 0