Fix dotfile restore bug in loop