add instanceof checks