Fixed undefined error in the message handling, finally