bug fixes in app.php