add error checking to Bson