Query update and ajax fix