Fixes #226.  Also fixed some compiler warnings.
Merge pull request #227 from jpav/master

Fixes #226.  Also fixed some compiler warnings.