Updated to check for resources header before trying to use it.