fix memory order problem