Adding patch from upstream to fix libdb issues