Fixed resource handling

This change set fixes resource handling