A bunch of small fixes