safe guard against bad input