Replaced realpath() by truepath() (see: http://stackoverflow.com/a/4050444/1882566)