solving bugs with the algo