Fixed some variable errors and lack of newline on log files