Fixed a bug with sendMessage