Fix and unit test