Fix foreground / background bug