add logging + raise TypeError