fix scheduler wait function & tcp client function