Bunch of minor fixes