Fix task state synchronization