MongoDB migration - bug fixing