Add error handling for data