should work but segmentation fault (array too large for stack?)