Merge pull request #1 from mathka/master

Fixed bug in toArray() method