Add bound checks. Add test for bound checks.