Ensure to run return checks when NULL is returned

Fixes #2712
Cleanup unused function from JIT