Fixes by snufkin.
Merge pull request #1 from alippai/master

Fixes by snufkin