Fixed bug in curve drawing