Fix overly strict bounds checking