Fix bug. Delete query segment -refs BT#8186