Bug fixes.
Improved test.