WIP: Fix segfault from bad ref counting.