Fix checking write permissions.