fixed Coverity issue 1187578. Using Invalid Iterator.