Fix nil exception and double sleep duration