ref #66: fix some issues with mongo/postgre conversion