Added type guards into processRawFieldData

We need to make sure to check what is the data type of the $data
argument because it may vary.

Fixes #31