resourceToArray method fixed