Fixed test and code