added expanduser for tilde paths