replaced is_a with instanceof