Fix legacy anchor module to add fragment only when required