Fixed input validation for null