Fixed bug in note write