Fix self.dir and dir variable errors

PSA: Don't use variables with the same name as a python builtin