fixed read length error for variable length arrays