Fixed possible error due to ObjectId failing

All relevant tests pass.