Fixed some edge cases

these were really slowing down the mesher when it was run with a uniform grid, and it is still slower to run with a uniform grid than with a random grid but it's of comparable speed nonetheless