improve redis connection handling