fix some small bugs, get simple iname ref counting working