Mainly bugfixes