fix bug for postgres