Fix test algorithm