Bug fixing Query