And why did the author of Hebrews quoted from this verse if it was badly translated? I'd really appreciate any help I could get because I'm having difficulties with this. Thanks
Psalm 45:6 was not badly translated, in my opinion. It's true that sometimes the Masoretic text which the KJV Old Testament comes from doesn't match the New Testament author's quotation (in which case it either matches the Septuagint, or other sources no longer extant) but happily this is one place where the Old Testament jibes almost perfectly with its quotation in the New Testament.
Psalms 45:6 Thy throne, O God, is for ever and ever: the scepter of thy kingdom is a right scepter.
Hebrews 1:8 But unto the Son he saith, Thy throne, O God, is for ever and ever: a scepter of righteousness is the scepter of thy kingdom.
The Dead Sea Scrolls, according to my studies, give credence to the Masoretic Text's accuracy in that around 60% of Old Testament scripture found at Qumran conforms to that text type. So I think "O God" can reasonably be assumed to be translated correctly in both instances here, the testimony of two witnesses being ostensibly true.