Fix "TypeError: 'NoneType' object is not iterable" in prepare_hooks

This was causing one of the tests to fail.