throw exception on bad format