reworked processing of handler return value to support io.Reader