stop querying for undelivered messages if there are none (issue #172)