Fixed array.slice and array.reverse

* Added some missing local declarations
* Fixed array.slice returning one extra item
* Fixed array.reverse always returning empty array