Fixes #28: protect at file replace.