Add more correct bound checking in filter_mb().