bugfix (report by braibant) and better error for matching (report by salvucci)