Improving ui queue mechanism to avoid bad access memory