fix sleep bug