little refactor...
--> and add "try" for connect to database