Fixed bug in buildMessage