Fixed tests and bugs.