Fix beforeWrite check
Merge pull request #5 from codemix/fix-beforewrite-check

Fix beforeWrite check