adding case insensitivity to loss functions