Fix firefox socket closing on page unload, fix ping request, clean core PHP code a bit more and improve server console output