Putting back SM_PATH the way it should be and eliminating chdir in the