Fix magit-pg function