Bare minimum of fixes to bwtdt so it doesn't break too much.