Small memory/easier gc related fixes

fixes two cases where $this would be referenced in inner classes.