apphook firing only if apphook present

fixes #2911