Added global statement for socket handler.