fix fields_for_document NoneType error