fixed double query being appended