various small improvements and fixes to LMDB