Resource sharing bug fixes