Install rules, fixed build system, fixed a segfault