Fix invaild input problem