fixed possible overflow in softmax loss