Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java	(revision 31544)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java	(revision 31549)
@@ -18,5 +18,5 @@
 
   /** The time the image was captured, in Epoch format. */
-  private long capturedAt;
+  protected long capturedAt;
   /** Sequence of pictures containing this object. */
   private MapillarySequence sequence;
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImportedImage.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImportedImage.java	(revision 31544)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImportedImage.java	(revision 31549)
@@ -21,5 +21,4 @@
   protected File file;
   /** The date when the picture was taken. */
-  public long datetimeOriginal;
 
   /**
@@ -59,11 +58,12 @@
     this.file = file;
     try {
-      this.datetimeOriginal = MapillaryUtils.getEpoch(datetimeOriginal, "yyyy:MM:dd hh:mm:ss");
+      this.capturedAt = MapillaryUtils.getEpoch(datetimeOriginal,
+          "yyyy:MM:dd hh:mm:ss");
     } catch (ParseException e) {
       try {
-        this.datetimeOriginal = MapillaryUtils.getEpoch(datetimeOriginal,
+        this.capturedAt = MapillaryUtils.getEpoch(datetimeOriginal,
             "yyyy/MM/dd hh:mm:ss");
       } catch (ParseException e1) {
-        this.datetimeOriginal = MapillaryUtils.currentTime();
+        this.capturedAt = MapillaryUtils.currentTime();
       }
     }
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/MapillaryUser.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/MapillaryUser.java	(revision 31544)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/MapillaryUser.java	(revision 31549)
@@ -37,6 +37,6 @@
             .getString("username");
       } catch (IOException e) {
-        Main.error(e);
-        isTokenValid = false;
+        Main.info("Invalid Mapillary token, reseting field");
+        reset();
       }
     return username;
@@ -66,6 +66,6 @@
             .getString("images_policy");
     } catch (IOException e) {
-      Main.error(e);
-      isTokenValid = false;
+      Main.info("Invalid Mapillary token, reseting field");
+      reset();
     }
     hash.put("images_policy", images_policy);
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java	(revision 31544)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java	(revision 31549)
@@ -211,5 +211,5 @@
     String key = MapillaryUser.getUsername() + "/" + uuid.toString() + "/"
         + image.getLatLon().lat() + "_" + image.getLatLon().lon() + "_"
-        + image.getCa() + "_" + image.datetimeOriginal + ".jpg";
+        + image.getCa() + "_" + image.getCapturedAt() + ".jpg";
 
     String policy = null;
Index: applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java
===================================================================
--- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java	(revision 31544)
+++ applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java	(revision 31549)
@@ -118,5 +118,6 @@
    *           not one of the values mentioned above
    */
-  public static double degMinSecToDouble(RationalNumber[] degMinSec, String ref) {
+  public static double degMinSecToDouble(RationalNumber[] degMinSec,
+      String ref) {
     if (degMinSec == null || degMinSec.length != 3) {
       throw new IllegalArgumentException("Array's length must be 3.");
@@ -145,5 +146,6 @@
     }
 
-    result = 360 * ((result + 180) / 360 - Math.floor((result + 180) / 360)) - 180;
+    result = 360 * ((result + 180) / 360 - Math.floor((result + 180) / 360))
+        - 180;
     return result;
   }
@@ -159,5 +161,6 @@
    * @throws ParseException
    */
-  public static long getEpoch(String date, String format) throws ParseException {
+  public static long getEpoch(String date, String format)
+      throws ParseException {
     SimpleDateFormat formatter = new SimpleDateFormat(format);
     Date dateTime = formatter.parse(date);
@@ -229,6 +232,6 @@
    *           If the file doesn't have the valid metadata.
    */
-  public static MapillaryImportedImage readJPG(File file) throws IOException,
-      ImageReadException {
+  public static MapillaryImportedImage readJPG(File file)
+      throws IOException, ImageReadException {
     return readJPG(file, false);
   }
@@ -259,16 +262,17 @@
     if (metadata instanceof JpegImageMetadata) {
       final JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata;
-      final TiffField lat_ref = jpegMetadata
-          .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF);
+      final TiffField lat_ref = jpegMetadata.findEXIFValueWithExactMatch(
+          GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF);
       final TiffField lat = jpegMetadata
           .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_LATITUDE);
-      final TiffField lon_ref = jpegMetadata
-          .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF);
+      final TiffField lon_ref = jpegMetadata.findEXIFValueWithExactMatch(
+          GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF);
       final TiffField lon = jpegMetadata
           .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_LONGITUDE);
-      final TiffField ca = jpegMetadata
-          .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION);
+      final TiffField ca = jpegMetadata.findEXIFValueWithExactMatch(
+          GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION);
       final TiffField datetimeOriginal = jpegMetadata
-          .findEXIFValueWithExactMatch(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL);
+          .findEXIFValueWithExactMatch(
+              ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL);
       if (lat_ref == null || lat == null || lon == null || lon_ref == null) {
         if (exceptionNoTags)
@@ -307,8 +311,6 @@
    */
   public static MapillaryImportedImage readNoTags(File file) {
-    return readNoTags(
-        file,
-        Main.map.mapView.getProjection().eastNorth2latlon(
-            Main.map.mapView.getCenter()));
+    return readNoTags(file, Main.map.mapView.getProjection()
+        .eastNorth2latlon(Main.map.mapView.getCenter()));
   }
 
@@ -327,4 +329,5 @@
     double HORIZONTAL_DISTANCE = 0.0001;
     double horDev;
+
     if (noTagsPics % 2 == 0)
       horDev = HORIZONTAL_DISTANCE * noTagsPics / 2;
@@ -332,4 +335,30 @@
       horDev = -HORIZONTAL_DISTANCE * ((noTagsPics + 1) / 2);
     noTagsPics++;
+
+    ImageMetadata metadata = null;
+    try {
+      metadata = Imaging.getMetadata(file);
+    } catch (IOException e) {
+      Main.error(e);
+    } catch (ImageReadException e) {
+      Main.error(e);
+    }
+    if (metadata instanceof JpegImageMetadata) {
+      final JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata;
+      final TiffField datetimeOriginal = jpegMetadata
+          .findEXIFValueWithExactMatch(
+              ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL);
+      if (datetimeOriginal == null)
+        return new MapillaryImportedImage(pos.lat(), pos.lon() + horDev, 0,
+            file);
+      else {
+        try {
+          return new MapillaryImportedImage(pos.lat(), pos.lon() + horDev, 0,
+              file, datetimeOriginal.getStringValue());
+        } catch (ImageReadException e) {
+          Main.error(e);
+        }
+      }
+    }
     return new MapillaryImportedImage(pos.lat(), pos.lon() + horDev, 0, file);
   }
@@ -386,13 +415,15 @@
           maxLon = img.getLatLon().lon();
       }
-      Bounds zoomBounds = new Bounds(new LatLon(minLat, minLon), new LatLon(
-          maxLat, maxLon));
+      Bounds zoomBounds = new Bounds(new LatLon(minLat, minLon),
+          new LatLon(maxLat, maxLon));
       // The zoom rectangle must have a minimum size.
-      double latExtent = zoomBounds.getMaxLat() - zoomBounds.getMinLat() >= MIN_ZOOM_SQUARE_SIDE ? zoomBounds
-          .getMaxLat() - zoomBounds.getMinLat()
-          : MIN_ZOOM_SQUARE_SIDE;
-      double lonExtent = zoomBounds.getMaxLon() - zoomBounds.getMinLon() >= MIN_ZOOM_SQUARE_SIDE ? zoomBounds
-          .getMaxLon() - zoomBounds.getMinLon()
-          : MIN_ZOOM_SQUARE_SIDE;
+      double latExtent = zoomBounds.getMaxLat()
+          - zoomBounds.getMinLat() >= MIN_ZOOM_SQUARE_SIDE
+              ? zoomBounds.getMaxLat() - zoomBounds.getMinLat()
+              : MIN_ZOOM_SQUARE_SIDE;
+      double lonExtent = zoomBounds.getMaxLon()
+          - zoomBounds.getMinLon() >= MIN_ZOOM_SQUARE_SIDE
+              ? zoomBounds.getMaxLon() - zoomBounds.getMinLon()
+              : MIN_ZOOM_SQUARE_SIDE;
       zoomBounds = new Bounds(zoomBounds.getCenter(), latExtent, lonExtent);
 
@@ -423,11 +454,10 @@
     }
 
-    ArrayList<MapillaryAbstractImage> firstHalf = new ArrayList<>(firstImage
-        .getSequence().getImages()
-        .subList(0, firstImage.getSequence().getImages().indexOf(secondImage)));
-    ArrayList<MapillaryAbstractImage> secondHalf = new ArrayList<>(firstImage
-        .getSequence()
-        .getImages()
-        .subList(firstImage.getSequence().getImages().indexOf(secondImage),
+    ArrayList<MapillaryAbstractImage> firstHalf = new ArrayList<>(
+        firstImage.getSequence().getImages().subList(0,
+            firstImage.getSequence().getImages().indexOf(secondImage)));
+    ArrayList<MapillaryAbstractImage> secondHalf = new ArrayList<>(
+        firstImage.getSequence().getImages().subList(
+            firstImage.getSequence().getImages().indexOf(secondImage),
             firstImage.getSequence().getImages().size()));
 
@@ -455,6 +485,6 @@
       ret += tr("Downloading Mapillary images");
     else if (MapillaryLayer.getInstance().getData().size() > 0)
-      ret += tr("Total Mapillary images: {0}", MapillaryLayer.getInstance()
-          .getData().size());
+      ret += tr("Total Mapillary images: {0}",
+          MapillaryLayer.getInstance().getData().size());
     else
       ret += tr("No images found");
