Fixed some problems with logging & logging to file.