Added additional test for badly formatted files, fixed bug in that regard