making sleep work crossplatform