Added a check for a directory