Added tests.
Fixed some test issues.