Fixed issue in ordering of doing stuff in opening of log files