Bugfix: zero elements should not cause error.