fix issue with traversing elements it shouldn't