WIP: Fix 'resource' for reference fields

#233

Next is adding tests to prevent regression.