Fixes NullPointerException caused by unloading the resources