Suppression of microbunching instability with magnetic bunch length compression in a linac-based free electron laser