Fixing bug where ray cuts corners through diagonals