Support >=4096 dimensions, fixes issue499.