Fix validity previous_query