diff --git a/gmap.module b/gmap.module
index ebc6a5d..08e6ae9 100644
--- a/gmap.module
+++ b/gmap.module
@@ -547,15 +547,15 @@ function gmap_regenerate_markers() {
   $contents .= "Drupal.gmap.iconpath = " . drupal_json_encode(base_path() . variable_get('gmap_markerfiles', drupal_get_path('module', 'gmap') . '/markers')) . ";\n";
   $contents .= "Drupal.gmap.icondata = " . drupal_json_encode(gmap_get_icondata(TRUE)) . ";\n";
 
-  $dir = "public://js/";
-
+  $dir = 'public://js/';
+  $filepath = $dir . 'gmap_markers.js';
   // Make sure js/ exists in the files folder.
-  if (file_prepare_directory($dir, FILE_CREATE_DIRECTORY)) {
-    $file = file_save_data($contents, 'public://js/gmap_markers.js', FILE_EXISTS_REPLACE);
+  if (file_prepare_directory($dir, FILE_CREATE_DIRECTORY) && ($file = file_save_data($contents, $filepath, FILE_EXISTS_REPLACE))) {
     variable_set('gmap_marker_file', $file->fid);
   }
   else {
-    drupal_set_message(t('GMap is unable to save the marker bundle. Markers will not work!'), 'error');
+    drupal_set_message(t('GMap is unable to save the marker bundle, so the markers will not work. Please check file system permissions of the %filepath!', array('%filepath' => $filepath)), 'error');
+    watchdog('gmap', 'GMap write error when saving the marker bundle to %filepath.', array('%filepath' => $filepath), WATCHDOG_ERROR);
   }
 
   // Also regenerate the cached marker titles array
