More unit tests. Fixed toArray