update with better error handling