fix alignment writing function. seem everything is back...