a lot of small fixes