initialize memory before use, don't write beyond array limits