Mongo id fixes

Fixes a few issues involving mongodb

Closes #39 
Closes #43