gustafn
committed
on 11 Jun 18
make code more robust against invalid input