Trying to solve type error