made casting of primitives more generic
add ToLongArrayFunction