more flexible environment handling