added an exception for division by 0