fix memory alignment bug