Fixed an integer oveerflow that was causing a divide by zero error