You can safely change this 
```ruby
cfg[:roles].class.to_s() != "Hash"
```
to
```ruby
cfg[:roles].class != Hash
```
Also for endpoints