added exception handler in connection