use usleep instead of sleep