Error handling for db reset and remove some exit(0) to allow chaining of commands