It's probably coming in contact with a body that isn't the player. You could check with:
if body.has_method("ouch"): body.ouch(position.x)
You can also check for custom classes.
if body is Player: body.ouch(position.x)