Fix a bug in LS protocol