Mitigation of microbunching instability in x-ray free electron laser linacs