Fix purging of functions