fix some issues with postgresql