Fixed pwd function so it works properly.