improved error handling and status reporting