Adding exception handling for non-package directories