Fix for readdir and non-dir paths