fixing function return in write context for __construct when checking env var