Moved change dir to earlier