fixed a bug where the output array was too short if certain features had never been seen