Bugfixes, mainly bugfixes