Check against instanceof before trying to create a new object