Changed way of getting main server in listener