Add foreground check