Fix some bugs.
Bugfixes.