Bugfixes

Fixed some bugs. The commit messages is self-explanatory.