fixed a bug on parseMessage function