updated to ensure server exists