Judge orders sex change for Mass. murder convict