exits on invalid input