fixed resolve to work with temporary files and parent directories