bug in resource constructor