[imp] switch to onBeforeCompileHead trigger for cleanup