instanceof check fixes