fix bugs in resource.php