Fix domain index bounds

Fixes movement issues and a crash.