fix bug in lib.php