Added check in turn functions to hangle the turn infinitely case