fixed socket io emit function