Add bounds check