Fix to write_resource method

The data structure here was being passed twice; removes the second
reference and only passes the comprehension version.