fix app crash caused by database