fix socket listener code