fix race condition in index increment
remove redundancy modulo
modify method access control