Various bugfixes'