Added ugly code for supporting typed arrays (kind of)