Space before parenthesis


I have seen an answer to my question for different citing styles, but none of the tips has worked for me.

I am using Harvard style and edited it to include cited pages. Even though it works fine when I use Author (Year), when I cite it normally, I get an extra space before the parenthesis when I leave the pages field blank. Example:

With cited pages: (Berglund, 2018, pp. 805-808)

Without cited pages: (Berglund, 2018 )

Can you help me? I have attached my style edition.

Thank you!