Corrected a bug that app crashes