Fixed not checking for bad layouts correctly.