fix resolveReferences()
add safe JSON.stringify() substitute
Merge pull request #159 from codemix/fix-resolve-references

Fix resolve references