Fixed a bug that threw a TypeError.