Fixed some some potential problems.
Merge pull request #54 from meltmedia/bug-fixes

Fixed some some potential problems.