Fixed the alignment table generation algorithm.