fixed the crash due to database