hook.py: Fixes booleans converted to integers on Python 2.