Added error checking to server.py