Fix cleanup on other functions