update bound checks with generic function