fixed bugs when divided unevenly