Fixed restore logic