P began receiving disability benefits under the Social Security Act. A continuing disability investigation led to the cessation of P's disability benefits. The termination of benefits was upheld after a hearing before an Administrative Law Judge. P's request for review of the hearing decision was denied by the Appeals Council. P sought judicial review of the Secretary's decision. The court ruled against P. However, this court held in a different case that Social Security disability benefits cannot be discontinued without a finding that the claimant's condition has improved and that failure to apply the correct legal standard is, by itself, sufficient to command reversal of a termination case. The district court, sua sponte reversed P's termination and directed D to reinstate P's benefits. P applied for attorney's fees and expenses arguing that the agency's position, both in the decision to terminate P's benefits and in the civil action, was not substantially justified and was taken in bad faith. D responded to the motion by arguing that the medical improvement standard had not yet been adopted by the agency or in this circuit at the time of the termination decision or at the time this action was brought. The district court agreed with D and denied P’s motion for attorney fees. This appeal resulted.