pwd fixed with error printout