fixed headers chaos, fixed horrible bug in memory manager