fix input validation