Error using form API on AJAX submit
This line is wrong: 

$form_state['values'] = $foo;


No idea what you are trying to do here, but you must not mess with $form_state['values'] directly.

And what you are trying to do with the #default_value shouldn't be necessary either. Form API should automatically re-use an already entered value, without you having to set it as the default_value.