add instanceof check