Fix task running twice in parallel