only refresh metadata when necessary