Fix #168 Better support for custom handler