checks matches correctly