Fixed waitTask snippet