store cwd and parent dir in beginning of script