Fix toArray glitch if list is empty