Fixed bug in smoothing midlines