Rework fix for previous bug

Prefer checking function existance over next global variables