Some minor bugfixes
Fixes some bugs.