Bunch of minor unrelated fixes