Fix crash because of reference to resource not existing yet