Fixes and add test.