fix open port failed bugs.