Improve logic for needsupdate