Fix: includes, memory leaks, static build support