Fix Crashes when sending message from Moodle Server