Fixed issue with realpath returning false negatives for non-executable directories