improve active function detection