fix a bug when the resource is build with some errors - the resource was wrongly assumed valid