Fix out_dir usage, and remove debug code.