Several fixes from upstream Wt