Allow 4 or 5 output files based on stderr existence
Fix memory error that cppcheck errors on

@macumber please take a quick look at this for a second set of eyes