Fix possible buffer overrun (these arrays may be accessed at (1..512) below)