Optimize comparisons for speed up 'import --replace'. Thanks to @goekesmi. Fixes #75.