remove end_sgs macro