Change default output dirname and handle output filename for SA