When adding dependencies to the stack, dont make it permanent if dependencies are not calculated yet
So it seems we save the dependency in the cache twice: once at the beginning (when there are no dependencies calculated) and another one later (after dependencies are calculated). This quick fix would make sure that the first time it is saved it is not declared as PERMANENT, because if something breaks in the middle then it will be left in the cache as permanent and that is wrong..
Edited by abarrios