Adding proper synchronization to task bookeeping