fixed foreground/background mapping issue when rendering