database module from 3.4 branch