Thread sleep bug solved