Use proper stat flags for chmod