Fix unassignment error and previous queries display