env: add check/apply logic to himport_r()