fixed overflow probem with partial matching