Fixed integration with refaker (rebased)

The last patch was broken, so I've reworked the issue after rebasing the latest changes.
I am also not very clear at this, but I encountered this issue before, see c48d543e632ccfce94b99068b3dfba9a1514d5e1.