modified api/index.php