you can try to wrap up like that:

```
total = overview['queue_totals'].is_a?(Hash) ? overview['queue_totals']['messages'] : 0 
```