Fixed a few bugs.
Some more fixes.