fixed double-check on write