Fix bug in inconsistent date parsing, and improve error handling when sending messages