Fixed a bug that will cause crash.