Fixed indexing bug in isFlush