Fix uninitialized variable message (messageId typo)
Various Sqlite fixes