Error handling for JSON and database connection, fixed package.json