bug fix in func.php