The problem is how you are passing the parameters into the $modx->runSnippet() call
Anyway, here is a slight variation (tweaked to your needs) on something I coded up for someone the other day - it seems to be quite a popular request just lately

You can use this in place of your standard Wayfinder call:
<?php
if (count($modx->getChildIds($modx->documentObject['id'],1)) == 0 || $modx->runSnippet('Wayfinder', array('startId'=>$modx->documentObject['id'])) == '') {
// no children or output from wayfinder will be an empty string, so use the parent ID as the start ID
return $modx->runSnippet('Wayfinder', array('startId'=>'1', 'level'=>'1','sortBy'=>'menutitle'));
} else {
// has children and output will not be an empty string, so use this page's ID as the start ID
return $modx->runSnippet('Wayfinder', array('startId'=>$modx->documentObject['id'], 'level' => '1','sortBy'=>'menutitle'));
}
?>
Doing it this way means you don’t have to hack the Wayfinder code which makes it easier when it comes to upgrading to the next release
Hope that helps,
Garry