fixed broken checkWrite