better queue empty detection

Change-Id: I732d7509f147ce86131cccd2e878218113048fd2