enhanced-hooks-fix: call SafeGC() at the end and fix return bug