modified ams-enc.c so it works for any zeroangle