Fixes #502 to support root_name even when object is nil