Correcting the errors+adding test