fix a few issues relate to the error handling of ToChan() method