Applied fixes from lts branch

Fixed exit code  for merge.
Added broadcasting send_wait at state removing.