server: preserve mode on replacement files