Correct a TypeError problem