Fixed missing instanceof check