type error in example code