bugfixed runtime exception when connect