diff --git a/entityreference_prepopulate.module b/entityreference_prepopulate.module
index 9310330..4c2e09e 100644
--- a/entityreference_prepopulate.module
+++ b/entityreference_prepopulate.module
@@ -92,6 +92,11 @@ function entityreference_prepopulate_field_attach_form($entity_type, $entity, &$
       // in case the form is rebuilt by AJAX requests.
       $field_name = $field['field_name'];
 
+      if (isset($form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field_name])) {
+        $form[$field_name][$lang][0]['default']['#default_value'] = $form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field_name];
+        continue;
+      }
+
       if ($ids = entityreference_prepopulate_get_values($field, $instance)) {
         $form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field_name] = $ids;
       }
@@ -116,6 +121,11 @@ function entityreference_prepopulate_field_attach_form($entity_type, $entity, &$
         }
       }
       elseif (in_array($settings['fallback'], array('form_error', 'redirect', 'hide'))) {
+        if (!empty($form_state['triggering_element']['#ajax'])) {
+          // We are inside AJAX, so values can't be taken from URL at the
+          // moment, so we prevent applying any "fallback" behaviors such as redirect.
+          return;
+        }
         $message = t('Field @label must be populated via URL.', array('@label' => $instance['label']));
         if ($settings['fallback'] == 'form_error') {
           form_error($form, $message);
