Fix mishandling of non-ObjectId ids in calls to find_by_id

@byels