added error handling for ListenAndServe