improved bg color handling