getting a double-"free" somewhere. need to debug