Fix prev query