[core] Fix environment preparation