fixed bugs before sleep