cleanup and helpers for testing