fixed ordering bug to ensure old log file is cleaned up