refresh dex only when necessary