Fix query with id