Fix to gxsm along with tests