Fixed a bug in filling the arrays when aligning matches