Improve heap API detection