fix faulty CREATE statement, fix error on no messages in database