catch situations where nil would cause array index exceptions