better error handling && events