In the book KatichaobanThai of Jue Satawethin, not year specified Published on page 8-9 explains the meaning of the word "Ghost" that it is of many kinds. There are both good and bad. Give you praise and worship offerings. The devil is to blame, we have to ask for offerings, not to do harm.
Ghosts and spirits, praising you Wai Part of the blame, we have a way to bribe Wai asking not to harm.