Fix makeflow's segfault, reported by Lauren Assour

A function expected struct dag_lookup_set, but it was getting a
struct dag.
Corrects a misunderstanding in fd2079b89fed3ed8cf62e96951ee3f96af1a8acb
which fixes a bug reported by Austin Walker.
Fixed some bad permissions.
Fixed more bad permissions.