fix instanceof checks