Fix for leveling up algorithm