Fixed bugs in element exists step