fix the crash issue when change orientation of screen