size() returned wrong value for empty arrays.

- corrected problem
- added to unit tests