call the cleanup functions