diff --git a/VIPSWeb/views.py b/VIPSWeb/views.py
index 63023eebd9a7490cd51862e3bdc4e0ce80c9195f..329a49f9bd57718854962e97f83c96bc6d448b19 100755
--- a/VIPSWeb/views.py
+++ b/VIPSWeb/views.py
@@ -28,36 +28,39 @@ from django.views.decorators.gzip import gzip_page
 from django.views.decorators.cache import cache_page
 
 def index(request):
-    # Check if user is on stock Android browser, which performs poorly with OpenLayers
-    user_is_stock_android = False
-    user_agent = request.META['HTTP_USER_AGENT']
-    #print user_agent
-    if user_agent.find("Android") >= 0 and user_agent.find("Windows") < 0:
-        chrome_index = user_agent.find("Chrome")
-        if  chrome_index < 0:
-            user_is_stock_android = True
-        else:
-            chrome_version = user_agent[chrome_index+7:chrome_index+9]
-            if int(chrome_version) < 40:
+    try:
+        # Check if user is on stock Android browser, which performs poorly with OpenLayers
+        user_is_stock_android = False
+        user_agent = request.META['HTTP_USER_AGENT']
+        #print user_agent
+        if user_agent.find("Android") >= 0 and user_agent.find("Windows") < 0:
+            chrome_index = user_agent.find("Chrome")
+            if  chrome_index < 0:
                 user_is_stock_android = True
-    
-    user_uuid = request.GET.get("returnUUID",None)
-    if user_uuid == None:
-        user_uuid = request.session.get("user_uuid","")
-    
-    # Get front page categories. This is defined in local_settings.py
-    #message_tags = MessageTag.get_message_tags(translation.get_language())
-    # Get advertisements, if any
-    #advertisements = Advertisement.objects.exclude(pub_date__gte=datetime.date.today()).exclude(exp_date__lte=datetime.date.today()).order_by('-pub_date')[:1]
-    advertisements = Advertisement.objects.exclude(pub_date__gt=datetime.date.today()).exclude(exp_date__lt=datetime.date.today()).order_by('-pub_date')[:1]
-    # Last 10 messages
-    context = {
-               'user_uuid': user_uuid,
-              'advertisements': advertisements,
-              'crop_categories': CropCategory.get_crop_categories(translation.get_language()),
-              'user_is_stock_android':  user_is_stock_android,
-              }
-    return render(request, 'index.html', context)
+            else:
+                chrome_version = user_agent[chrome_index+7:chrome_index+9]
+                if int(chrome_version) < 40:
+                    user_is_stock_android = True
+        
+        user_uuid = request.GET.get("returnUUID",None)
+        if user_uuid == None:
+            user_uuid = request.session.get("user_uuid","")
+        
+        # Get front page categories. This is defined in local_settings.py
+        #message_tags = MessageTag.get_message_tags(translation.get_language())
+        # Get advertisements, if any
+        #advertisements = Advertisement.objects.exclude(pub_date__gte=datetime.date.today()).exclude(exp_date__lte=datetime.date.today()).order_by('-pub_date')[:1]
+        advertisements = Advertisement.objects.exclude(pub_date__gt=datetime.date.today()).exclude(exp_date__lt=datetime.date.today()).order_by('-pub_date')[:1]
+        # Last 10 messages
+        context = {
+                   'user_uuid': user_uuid,
+                  'advertisements': advertisements,
+                  'crop_categories': CropCategory.get_crop_categories(translation.get_language()),
+                  'user_is_stock_android':  user_is_stock_android,
+                  }
+        return render(request, 'index.html', context)
+    except ValueError:
+        return render(request, '503.html')
 
 # Serving settings for JavaScript
 def settings_js(request):
diff --git a/common/util.py b/common/util.py
index cf2d8d36ddf5161e9a42b35db9064b51aa0cef98..74015f0aac788479dc27e6fd0b32c3493baef232 100755
--- a/common/util.py
+++ b/common/util.py
@@ -1,6 +1,6 @@
 # coding: utf-8
 #
-# Copyright (c) 2014 NIBIO <http://www.nibio.no/>. 
+# Copyright (c) 2018 NIBIO <http://www.nibio.no/>. 
 # 
 # This file is part of VIPSWeb.
 # VIPSWeb is free software: you can redistribute it and/or modify
@@ -20,7 +20,17 @@
 # Author: Tor-Einar Skog <tor-einar.skog@nibio.no>
 
 from datetime import datetime
+from django.utils.dateparse import parse_datetime
 
 def get_unix_timestamp(datetime_object):
     """GET Unix timestamp (milliseconds since 1970-01-01 UTC) from datetime object"""
-    return (datetime_object - datetime(1970,1,1)).total_seconds() * 1000
\ No newline at end of file
+    # The strftime("%s") is UNIX implementation dependent
+    return int(datetime_object.strftime("%s")) * 1000
+    #return (datetime_object - datetime(1970,1,1)).total_seconds() * 1000
+
+def parse_json_timestamp(timestamp_str):
+    """ Either it's a UNIX timestamp or an ISO datetime string """
+    try:
+        return datetime.fromtimestamp(timestamp_str/1000)
+    except TypeError:
+        return parse_datetime(timestamp_str)
\ No newline at end of file
diff --git a/forecasts/models.py b/forecasts/models.py
index 1e5f71d08df68040107fd36349826429ff5606fb..a7ec4c20e1267bc7087a22df30780418d1ccb14e 100755
--- a/forecasts/models.py
+++ b/forecasts/models.py
@@ -17,7 +17,6 @@
 # along with VIPSWeb.  If not, see <http://www.nibio.no/licenses/>.
 # 
 
-from datetime import datetime
 import math
 import requests
 import json
@@ -27,6 +26,7 @@ from django.utils.translation import ugettext as _
 from django.conf import settings
 from django.db import models
 from django.utils import translation
+
 from django.core.exceptions import ValidationError
 
 from organisms.models import Organism
@@ -40,7 +40,9 @@ Represents a single result from the running of a forecasting model
 class ForecastResult:
     def __init__(self,forecast_result_id,valid_time_start,warning_status,all_values):
         self.forecast_result_id = forecast_result_id
-        self.valid_time_start = datetime.fromtimestamp(valid_time_start/1000)
+        #self.valid_time_start = datetime.fromtimestamp(valid_time_start/1000)
+        self.valid_time_start = util.parse_json_timestamp(valid_time_start)
+        print self.valid_time_start
         self.warning_status = warning_status
         self.all_values = all_values
         
diff --git a/forecasts/urls.py b/forecasts/urls.py
index 4782eb6a87fb6700507902e951f1562d0d1fed2b..d98c826d92f3dbc406058681cbd63a43fca9ec8a 100755
--- a/forecasts/urls.py
+++ b/forecasts/urls.py
@@ -25,10 +25,10 @@ urlpatterns = patterns('forecasts.views',
     url(r'^$', views.index, name='index'),
     # ex: /forecasts/5/
     #url(r'^(?P<forecast_id>\d+)/detail_highcharts_json/$', cache_page(60 * 15)(views.detail_highcharts_json), name='detail_highcharts_json'),
-    url(r'^(?P<forecast_id>\d+)/detail_highcharts_json/$', views.detail_highcharts_json, name='detail_highcharts_json'),
+    url(r'^(?P<forecast_id>-?\d+)/detail_highcharts_json/$', views.detail_highcharts_json, name='detail_highcharts_json'),
     #url(r'^(?P<forecast_id>\d+)/$', cache_page(60 * 15)(views.detail), name='detail'),
-    url(r'^(?P<forecast_id>\d+)/$', (views.detail), name='detail'),
-    url(r'^(?P<forecast_id>\d+)/(?P<latest_days>\d+)/$', (views.detail_latest_days), name='detail_latest_days'),
+    url(r'^(?P<forecast_id>-?\d+)/$', (views.detail), name='detail'),
+    url(r'^(?P<forecast_id>-?\d+)/(?P<latest_days>\d+)/$', (views.detail_latest_days), name='detail_latest_days'),
     url(r'^models/test/$', views.models_detail_test, name='models_detail_test'),
     url(r'^models/(?P<model_id>\w+)/$', views.models_detail, name='models_detail'),
     url(r'^models/js/modelLocalNames.js', cache_page(60 * 30)(views.model_local_names_js), name='model_local_names_js'),