tail, head overflow case fix
some stuffs has been moved to research package