Resolve a bug in the handling of db query responses