Do not use instanceof (dosn't work cross global env)