added check for opened port