bug fix in connect
add max retry setting, default by 4