better input check