Fixed destructors by keeping track when they are non-trivial.