handles when $return is not an array (recursive cases)