fix typo and minor refactor of the handlerwrapper