fixes in resource management