diff --git a/appointment-import/src/main/java/smash/appointment/parse/RedcapParser.java b/appointment-import/src/main/java/smash/appointment/parse/RedcapParser.java
index fd72363335ab807dd1a85d864c61f251b4ef2b7a..442e51e54ce01707902158ce38e8a5fe28324118 100644
--- a/appointment-import/src/main/java/smash/appointment/parse/RedcapParser.java
+++ b/appointment-import/src/main/java/smash/appointment/parse/RedcapParser.java
@@ -33,41 +33,45 @@ public class RedcapParser {
 				if (subject == null) {
 					logger.warn("Cannot find subject with id: " + ndNumber);
 				} else {
-					subject.addLanguage(tmp[4]);
-					subject.addLanguage(tmp[5]);
-					subject.addLanguage(tmp[6]);
-					subject.addLanguage(tmp[7]);
-					subject.setSex(tmp[3]);
-					subject.setBirthDate(tmp[2]);
-
-					//for now only PRC and flying team subjects
-					if (subject.getToBeSeenAt().startsWith("P") || subject.getToBeSeenAt().startsWith("F")) {
-						List<AppointmentEntry> subjectAppointments = new ArrayList<>();
-						if (!tmp[9].isEmpty()) {
-							subjectAppointments.add(createEntryLevelA(tmp[9], tmp[10], subject));
+					if (tmp.length < 8) {
+						logger.warn("Invalid row (not enough cells): " + line);
+					} else {
+						subject.addLanguage(tmp[4]);
+						subject.addLanguage(tmp[5]);
+						subject.addLanguage(tmp[6]);
+						subject.addLanguage(tmp[7]);
+						subject.setSex(tmp[3]);
+						subject.setBirthDate(tmp[2]);
+
+						// for now only PRC and flying team subjects
+						if (subject.getToBeSeenAt() == null || subject.getToBeSeenAt().startsWith("P") || subject.getToBeSeenAt().startsWith("F")) {
+							List<AppointmentEntry> subjectAppointments = new ArrayList<>();
+							if (!tmp[9].isEmpty()) {
+								subjectAppointments.add(createEntryLevelA(tmp[9], tmp[10], subject));
+							}
+
+							if (!tmp[13].isEmpty()) {
+								subjectAppointments.add(createEntryLevelB(tmp[13], tmp[14], subject));
+							}
+
+							if (!tmp[17].isEmpty()) {
+								subjectAppointments.add(createEntryLevelBG(tmp[17], tmp[18], subject));
+							}
+
+							if (!tmp[21].isEmpty()) {
+								subjectAppointments.add(createEntryLevelBV(tmp[21], tmp[22], subject));
+							}
+
+							if (!tmp[41].isEmpty()) {
+								subjectAppointments.add(createEntryLevelSB(tmp[41], subject));
+							}
+
+							if (!tmp[45].isEmpty()) {
+								subjectAppointments.add(createEntryLevelMPower(tmp[45], subject));
+							}
+
+							result.addAll(subjectAppointments);
 						}
-
-						if (!tmp[13].isEmpty()) {
-							subjectAppointments.add(createEntryLevelB(tmp[13], tmp[14], subject));
-						}
-
-						if (!tmp[17].isEmpty()) {
-							subjectAppointments.add(createEntryLevelBG(tmp[17], tmp[18], subject));
-						}
-
-						if (!tmp[21].isEmpty()) {
-							subjectAppointments.add(createEntryLevelBV(tmp[21], tmp[22], subject));
-						}
-
-						if (!tmp[41].isEmpty()) {
-							subjectAppointments.add(createEntryLevelSB(tmp[41], subject));
-						}
-
-						if (!tmp[45].isEmpty()) {
-							subjectAppointments.add(createEntryLevelMPower(tmp[45], subject));
-						}
-
-						result.addAll(subjectAppointments);
 					}
 				}
 
diff --git a/appointment-import/testFiles/redcap_imp.txt b/appointment-import/testFiles/redcap_imp.txt
index 34ea9b17b6b28a93d09992f7b117c410dc727075..8065e5c6c17ca5d0d5803ba08831feb0798a0406 100644
--- a/appointment-import/testFiles/redcap_imp.txt
+++ b/appointment-import/testFiles/redcap_imp.txt
@@ -5,3 +5,4 @@ ND0002	Visit 1	1956-05-22 14:53	M	Polish				Yes	2015-03-04 14:56	2015-03-04 17:4
 ND0002	Visit 2							Yes	2016-01-18 10:00	2016-01-18 13:10	1									Yes	2016-05-26	2016-05-26	1					Yes	2016-01-18	Yes	2016-01-18					Yes	Yes	2016-05-26	2016-05-26	Yes	2016-05-26	Yes	2016-01-18		
 ND0003	Visit 1	1957-07-15 09:21	F	Polish	German	Rusian	English	Yes	2015-03-11 09:25	2015-03-11 14:58	1	Yes	2015-11-12	2015-11-12	1													Yes	2015-03-11	Yes	2015-03-11											Yes	2015-03-11		
 ND0003	Visit 2							Yes	2016-04-27 11:31	2016-05-11 13:30	2					Yes	2016-06-16	2016-06-16	1	Yes	2016-08-18	2016-08-18	1					Yes	2016-04-27	Yes	2016-04-27					Yes	Yes	2016-04-27	2016-04-28	Yes	2016-07-28	Yes	2016-04-27		
+ND0003	Visit 3
\ No newline at end of file