fixed bad behavior of app
index.php integrated from fork