fix bug with pg