Cleanup and fixes for BSON
Compilation fixes
Fixes for 0.7.1