lots of small fixing