a bunch of small fixes