--- filefield_nginx_progress.module.orig	2011-02-25 03:13:56.000000000 +0100
+++ filefield_nginx_progress.module	2012-09-20 23:18:00.000000000 +0200
@@ -30,7 +30,7 @@ function filefield_nginx_progress_ajax($
   );
   
   $status = nginx_progress_fetch($key);
-  if ($status['state'] == 'uploading') {
+  if (!empty($status) && $status['state'] == 'uploading') {
     $progress['message'] = t('Uploading... (@current of @total)', array('@current' => format_size($status['received']), '@total' => format_size($status['size'])));
     $progress['percentage'] = round(100 * $status['received'] / $status['size']);
   }
@@ -112,17 +112,5 @@ function nginx_progress_fetch($key) {
   $url = url($base_url . '/progress', array('query' => array('X-Progress-ID' => $key), 'absolute' => TRUE, 'external' => TRUE));
 
   $response = drupal_http_request($url);
-  $status = array();
-  // strip the extraneous parts out leaving a comma delimited list.
-  if (preg_match("/\{(.*)\}/", $response->data, $matches) ) {
-    $items = explode(',', $matches[1]);
-    foreach ($items as $item) {
-      $array = explode(':', $item);
-      // strip quotes and spaces from key & value pair
-      $key = trim($array[0], "' ");
-      $value = trim($array[1], "' ");
-      $status[$key] = $value;
-    }
-  }
-  return $status;
+  return drupal_json_decode($response->data);
 }
