Additional conditional check added to prevent PHP notice uninitialized string offset 0 at line 148