[fix #22] Completed support for cleanup functions