added destructor, fixed mistake in tests