Added infinite loop error check in SS