fix to_h to include class name and safe_hash to not

@bcherry can you review this?