in reply to Challenge, try to fix the bug

In 5.10, it won't segfault. It will warn though, but the bug is (partially) fixed, and as far as I can tell, it's working in this case.