fix bugs in alignment