fixed incorrect logic for quote lookup