modify resource handling. #4