fix many file resolution problems which did not expand relative to current working dir.

Also, l* functions can not check using exists() as it will be false for existing symlink pointing to nowhere.
Merge pull request #463 from eregon/file_resolution

fix many file resolution problems which did not expand relative to cwd