Fix various errors.
Merge pull request #20 from theymos/master

Fixed various errors