Fixed problem caused by ObjectId() when a query runs