[bugfix] toArray returns [] with undefined