a lot of minor fixes.