fixed UI flashing bug, add delay for hiding UI