fix the issue of crashing during run time