Small bugfixes, but should solve a lot of problems