Solves a bug calculating badges