enabled batch output and fixed bugs related to multiple files