- fixed compile error; - create foreground directory if it does not exist yet; - moved progress bar stuff to separate file