diff --git a/lms/static/js/dashboard/legacy.js b/lms/static/js/dashboard/legacy.js
index 1db0f53b45f6600c4b7b1a740b289474470b9c59..e475cefdd25feef6e942a5a1e2e6d3999a2f796d 100644
--- a/lms/static/js/dashboard/legacy.js
+++ b/lms/static/js/dashboard/legacy.js
@@ -88,7 +88,7 @@
                                         courseNumber, courseName, enrollmentMode, showRefundOption, courseKey) {
              // This flag is added for REV-19 experiment
              var auditRefundableCourses = (window.experimentVariables || {}).auditRefundableCourses,
-                 courseInExperiment = courseKey.indexOf(auditRefundableCourses) > 0,
+                 courseInExperiment = auditRefundableCourses ? auditRefundableCourses.indexOf(courseKey) > -1 : false,
                  diagAttr = {};
 
              if (isPaidCourse || courseInExperiment) {