patching for begin.php, end.php, menu