to avoid panic

using a variable to store the result, then return, and then send the result to
channel.