Add try except block for --valid_states input

Fixes #779