Added range checks to element and subarray instantiation methods