Fix some bugs.
Test bench.