Fixed up error handling.