diff --git a/data/download_and_preprocess_dataset.sh b/data/download_and_preprocess_dataset.sh
index 8878b01ba360aaca51506ad1fddf386804e6c76c..93652923b68bee6867fd0c9bf9e6b6abc04949b6 100644
--- a/data/download_and_preprocess_dataset.sh
+++ b/data/download_and_preprocess_dataset.sh
@@ -1,5 +1,8 @@
 #!/usr/bin/env bash
 
+# exit if any command fails
+set -e
+
 if [ "$#" -ne 1 ]; then
   echo "Usage: $0 DATASET_NAME" >&2
   exit 1
diff --git a/video_prediction/datasets/kth_dataset.py b/video_prediction/datasets/kth_dataset.py
index f350f53e2406c1d5e7d64a19b366465b94de92f4..44e73912f835e50162cd9c9e81c4e410e99d8aef 100644
--- a/video_prediction/datasets/kth_dataset.py
+++ b/video_prediction/datasets/kth_dataset.py
@@ -117,8 +117,7 @@ def main():
     for partition_name, partition_fnames in zip(partition_names, partition_fnames):
         partition_dir = os.path.join(args.output_dir, partition_name)
         if not os.path.exists(partition_dir):
-            os.makedirs(partition_dir, exist_ok=True)
-
+            os.makedirs(partition_dir)
         read_videos_and_save_tf_records(partition_dir, partition_fnames)