Fix undefined $raw error

Replaces #580