Fixed major bugs from the conversion to arrays