minor improvements in server and error handling