fixed a bug that crashes the application.