lots of bugfixes.