Minor clean up and possible crash fix.
Merge pull request #39 from me4502/master

Few minor clean ups and possible crash fix.