modified sendMessage to fit gui-app