Bugfixes and small changes