adjust query to ensure ACOS doesn't fail