Fixed UI lockup caused by sleeping thread