Ok i figured out something. Im adding the Gallery images (like all other data) through the API.
When i store the post manually it works. When the data only comes from api it does not, even when the the data is stored in wp_postmeta EXACTLY the same way.
So there has to be something that is stored with the editor, that the api does not store.
But what could that be?