add constructor and prevent foreground check.