clean up apply.c