Check the pointer is correctly set to avoid SEGV
Merge pull request #409 from garaemon/fix-environment-modeling-pointer

Check the pointer is correctly set to avoid SEGV