fix race condition, cleanup
pending tests