Fixed input validation