fix calling as subprocess