Only call ah_gen from ah_check
Global variables are actually global

Who could have known?