Fix update_dependency script: cd into absolute path.
Bug fixes: resolved a segmentation fault in Redis access if deleted unconnected.

Additionally, several imrovements to avoid memory leaks.