Fix some logic in env

Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>