small improvements in the social.php file

Fixes problem in non-visible Social API on some specific cases.