Fix test and implementation