I checked the code and I had removed the U turn penalty long ago. So I was wrong.

But the code has also another problem, which is not really solveable. It has diffrent values for 45° and 90° curves. Since you are starting on a tile directly before a curve, it will result in a 45° curve and a 90° curve. The other will have two 90° curves. There is little that can be done about it, since the curvature of the last and the first tile cannot be calculated properly and must be guessed. (Since you need the previous and preprevious tile to check whether 45° or 90° bowing; but the preprevouis one is not available on the first tile.)

So in this situation you are stucked with waypoints.