found major bug on the algorithms