fix resource leak
upgrade libraries used to latest versions