Input validation fix