Fixed bug in getBG preventing array index overrun.