Fix bugs in base aligner