Updated check when within a directory