Fix scoping bug causing tasks not to be saved correctly.