fix cd() function