bug fixes in pg sync tool