added define guards to kernel.h and segment.h