A very simple solution:
Update your OS and use the latest version of Avast.
Stop trying to reinvent the wheel.