restore current path after modifying it.