cannot use a resource as an array index
Merge pull request #1 from sheepcow/master

Fixed using resource as array index