index.php bug fixes