Fix input validation