Fixed lifetime issues, but tests are still broken.