Fixed a race condition in inter-process messaging