Minor fixes to getcwd()