merged in some other fixes (by hand)