Fix bug where multiple cluster jobs output (-o *.out)  may be written to the same text file
Fixed bugs causing initialisation errors and division by zero errors