fixed input validation bug