fixed a bug with the resource factory