Fix broken zero-variance optimization