thread sleep fix