DB bugfixes
Merge branch 'develop' into mongodb