Various bugfixes
Bugfixes