Merge pull request #1575 from ppekrol/2.5

applied 3.0 fixes to 2.5
Making sure that we don't have a deadlock when disposing an embedded document store with http server enabled.
Make sure that we are only loading this once.
Avoiding NRE