removing bug from delete element call