Added element type check