Bug fixes

More bugfixes