fix undefined message variable bug