Fix funtion state error output bug