Fix alignToGrid() method