Fixed common prefix bug