add more error handling