PLPGSQL fix