Fix a bug for TypeError.