Fixing the optimization output transformation