This works due to race condition. Needs better implementation later.