Fixed the procedure that checks the environment. Fixed the time deadlock problem.
Merge branch 'bugfixes' into develop