Fix aligment bugs on all platforms