changed to custom bson implementation