Better foreground handling. No bug known.