Fix allow_failures
Add boundary checks