code cleanup

check nil when use redis.* helper functions.