Make metadata initialization work in transaction