Fix a bug in loop grammar definition