Fixed severe bug that caused Li and S to hang for certain parameters