fixed permissions and data race