Fix reference to undefined local variable

Also update the spec to check the error message
Merge pull request #11 from invisiblefunnel/fix-undefined-local-var

Fix reference to undefined local variable