Fixed cd to not cd if realpath fails.

Fixed cd to not cd if realpath fails.