New task code, still a bug in wait