Fixed UI flash problem