John Källén - 2010-05-10

* Fixes 2998046
* Fixes other bugs that were uncovered by fix to 2998046.