Added some exception handling to server