fix deque erase, the end() iterator cannot be used as erase position.