handle Unref correctly in tests