Add code to deal with unparseable references

Fix error: "local variable 'type' referenced before assignment"
in parse_reference
Merge pull request #187 from Connexions/fix-references

Add code to deal with unparseable references