Fixed possible memory corruption on message dispatch.