more work on env detection