Fix exception type and message. Fix isOdd for negative numbers.