Added env_dir support;
small fixes;