Various Bugfixes and small improvements