Backport various improvements from Tcl 8.5
merge-mark