Added auto-flush and replace trace manager functionality for testing