store.py: minor efficiency improvements