swapped write location to write method