rename waitproc into waitend