Fix 'resource' for reference fields to other entities

#233

Next is adding tests to prevent regression.