1.1 db tests fix for issue #236

A bunch of unit tests fixes backported from 1.2 branch