fix detect existing function on import