fixing sleeping check