moved packet allocation to before wait_control() call