Fixed app crash caused by sorting