Add lib constants to app.php, various bug fixes
Fix deleted items