Solved a bug in algo3