Make server scripts more robust