When Gender Diversity Makes Firms More Productive