input validity check