Fix bug in result array size