fix for env definition and result handle