change order of issubdirectory() calls to avoid error messages for non-apps