Added better error message when fields aren't defined.

Fixed the to_hash with placeholders.