Fixed bugs in list.c, list.h and kernel.c