Fix inverted logic and how the progress file is written