Remove obsolete TODOs, fix a rather substantial bug.