Fixed wrong index after rotating screen