Fixes issue #20

Replaced `assert` with `if` statement