make sure input is sane