Fixed an optimization in attempt_ext and added optimizations to align_ungapped