More fixes and error catching.