Added Exception handler for repairing database