Fix the empty array case

Closes #1