fixed appendArray and prependArray to support array-like objects (e.g. arguments)