added REG_ID to masterquery