No reason for this to be an array. You're not using the second element anyway.
```ruby
print_line(Rex::Text.to_hex_dump(mem['Data'][idx,512]))
```