Added a way to check if the reference is a directory