allocate environment monitor on the heap so it's not destryoed during deinitialization (depending on timing this can cause a crash in R)