some improvements for cross-platform and performance;
fixed initiate connects;