Fix some bugs.
Some performance bugs still.