SQL file fixed and some exeption catch fix