Fixed fucnction store query