final changes to fix email display and double message DB insertion bug