r3d: Add more input value validation