use dpkg -s instead of apt-cache policy -q.