fixed socket functions