fix issue where deeper structure would cause a string value to be passed to recusive call