Merge pull request #153 from ndawe/master

[MRG] Improved input checking