Fix for IndexOutOfBoundsException when determining execution plan with finalizer tasks

Fix for an IndexOutOfBoundsException when:
- b depends on a
- a is finalized by c
- b is finalized by c