fixes to make repeated flint_cleanup() calls safe