fixed crash bug on startup