fixed modulo procedure and uint64 write