fix a bug in recurse()