Corrected permission query functions to check first iff the path exists.