Use tmp instead of cur dir.
Use tmp while downloading, then move to target.
Fix bash debug mode.