Fix bug ASC-3651 - NPE when compiling some tamarin tests under IBM jdk 1.6
We were modifying elements in a TreeMap after the had been inserted in a way that altered what the ordering of the TreeMap should be. This caused later lookups to fail, as the search algorithm would end up taking the wrong path through the Tree and never find some elements that were in fact in the TreeMap. Now, remove the element from the TreeMap before we alter it. Apparently we were just getting lucky that this worked with the sun JDK (and previous IBM jdks).