modifiy cd to meet the situation where Sys.getenv("HOME") is not set.
modifiy "f." to be faster than previous version.