fixed bugs in function.php