some error checking when accessing messages db