crash fix

payload isnt an array in here
added err checks
Merge pull request #16 from barisusakli/patch-3

crash fix