Fixing Random query see BT#6261