Fix endswith bug in utils.get_app_model