runtime environment detection fix