minor tweaks to match detection