Fix start/end computation when reversing paths (fixes #1214)