replaced order of redis connection creation