fix for getcwd() bug