fix a bug in sorm_generate : write constraint wrong as type, put 'i++' in wrong place