Fixed os.sleep not sleeping for long enough with values below 1000ms.