fix a bug in resource model