fix instance counting bugs