fix deleteElement bug