Added error catching for dumping