fixed some bugs that prevented init,last,head,tail to work