catch OverflowError from pymongo
add auto-reconnect feature