Fixed reference to non-existent matches in function