fixed issue with non-existing pid

bson.errors.InvalidDocument: documents must have only string keys, key was 0