attemped fix for #39

This seams to be fixing #39.

It looks like you're required to increase the refcount of the resource every time you return it, instead of when you get and store it.