fix issue #653

Fixes the issue #653, but requires all custom methods toBson() to be const.