Added a lock in msgsync: One instance at a time