Fix for bad reference to freed memory.
Merge pull request #28 from jbcrail/fix_bad_memory_ref

Fix for bad reference to freed memory