added error handling to http handlers
added select handler