Oops, would still infinite loop on a bad module.

Should really fix #6552 this time.