Fix warnings with incorrectly assigned messages in exceptions