better handling of error.