Change method of error handling