Fix task running twice in parallel

fixes #616