Db pooling fixes

Fixes #3

@tmichel: merge it pls