Fix design flaw and improve test