Correctly wrap the handler function