better input exception handling