improve element assertion method