Fixed bug in resource creation