Bug fix for regularization