Fix warnings (and bugs)
Merge pull request #2 from tadzik/master

Fix warnings (and bugs)