Changing script to get current directory correctly