fix potential crash &&  optimize loading view when loading