Fix NPE on wrong resources.