custom function to set environment variable