Add safety check

Otherwise could raise a NomethodError when loading from YAML