Fixes to resource handling.