Input parameter validation

To fix issue #234