bug fix for pg